<template>
	<view>
		<view class="wrap-container">
			<view class="warp-input">
				<view class="warp-text">事件单号:</view>
				<u-input v-model="wh_repair_num" :type="type" :border="border" :height="height" :disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">关联位置:</view>
				<u-input v-model="eq_name" :type="type" :border="border" :height="height" :disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">执行人:</view>
				<u-input v-model="wh_repair_person" :type="type" :border="border" :height="height" :disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">响应时间:</view>
				<u-input v-model="maintenance_time" :type="type" :border="border" :height="height" :disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">提交时间:</view>
				<u-input v-model="wh_repair_create_time" :type="type" :border="border" :height="height"
					:disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">验收时间:</view>
				<u-input v-model="wh_complete_time" :type="type" :border="border" :height="height" :disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">故障现象:</view>
				<u-input v-model="wh_job_describe" :type="type" :border="border" :height="height" :disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">维修记录:</view>
				<u-input v-model="wh_repair_result" :type="type" :border="border" :height="height" :disabled="true" />
			</view>
			<view class="warp-input">
				<view class="warp-text">设备状态:</view>
				<u-input v-model="wh_equipment_status" :type="type" :border="border" :height="height"
					:disabled="true" />
			</view>
			<!--提交按钮-->
			<view class="button" @click="submit()"><text>验收</text></view>
		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: "",
				type: 'text',
				height: 60,
				border: true,
				wh_complete_time: "",
				wh_repair_person: "",
				wh_repair_result: "",
				wh_repair_num: "",
				eq_name: "",
				eq_id: "",
				is_edit: "",
				wh_declare_time: "",
				wh_equipment_status: "",
				repair_person_id: "",
				wh_repair_status: "",
				maintenance_time: "",
				wh_repair_create_time: "",
				wh_job_describe: "",
				tags: []
			}
		},
		created() {
			this.getEqView();
		},
		onLoad(e) {
			this.id = e.id
			// this.id = '901134661235769345'
		},
		onReady() {
			// this.getServerData();
		},
		beforeDestroy() {},
		methods: {
			getEqView() {
				this.$u.api.eqView({
					"algorithmProcessId": "orderById",
					"param": {
						"data": {
							id: this.id,
							organ_uuid: '',
							user_uuid: uni.getStorageSync('uuid')
						}
					}
				}).then(Response => {
					const res = Response.data.data.result.list[0];

					this.wh_complete_time = res.wh_complete_time;
					this.wh_repair_person = res.wh_repair_person;
					this.wh_repair_result = res.wh_repair_result;
					this.wh_repair_num = res.wh_repair_num;
					this.eq_name = res.eq_name;
					this.eq_id = res.eq_id;
					this.is_edit = res.is_edit;
					this.wh_declare_time = res.wh_declare_time;
					this.wh_repair_status = res.wh_repair_status;
					this.repair_person_id = res.repair_person_id;
					if (res.wh_equipment_status == 2) {
						this.wh_equipment_status = '运行';
					} else if (res.wh_equipment_status == 3) {
						this.wh_equipment_status = '停止';
					} else if (res.wh_equipment_status == 1) {
						this.wh_equipment_status = '异常';
					} else {
						this.wh_equipment_status = '维修维护';
					}
					this.maintenance_time = res.maintenance_time;
					this.wh_repair_create_time = res.wh_repair_create_time;
					this.wh_job_describe = res.wh_job_describe;
				})
			},
			navTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			submit() {
				this.$u.api.eqView({
					"algorithmProcessId": "check_accept",
					"param": {
						"data": {
							id: this.id,
							user_id: uni.getStorageSync('uuid')
							// user_id:'95960bdc-2e77-4d86-bea7-0b7b33ea0507'
						}
					}
				}).then(Response => {
					const res = Response;
					if (res.code == '200') {
						if (res.data.data.status == '406') {
							//提示错误信息
							this.$u.toast(res.data.data.message);

						} else {
							uni.navigateTo({
								url: "/pages/sys/eventwororder/eventorder/eventOrder"
							});
						}
					}

				})
			}
		}
	}
</script>
<style lang="scss">
	@import '../style/common.scss';
</style>